home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Devices / Qwertytunes / Qwertytunes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-03  |  2.7 KB  |  150 lines  |  [TEXT/KAHL]

  1. /*
  2.  * file: Qwertytunes.h
  3.  *
  4.  * started 12 January 1992 16:45
  5.  * david van brink
  6.  *
  7.  * A starting point for BigEasy programs
  8.  *
  9.  */
  10.  
  11. /*--------------------------
  12.     Inclusions
  13. --------------------------*/
  14.  
  15.  #include <Files.h>
  16.  
  17. /*--------------------------
  18.     Structures
  19. --------------------------*/
  20.  
  21. #define kDocVersion 1
  22.  
  23. #define kKeyRows 4
  24. #define kKeyColumns 10
  25. #define kKeyCount (kKeyRows * kKeyColumns)
  26.  
  27. #define kControllerCount 3
  28. #define kMaxPortCount 32                    /* the most ports to list in the menu */
  29.  
  30. typedef enum
  31.     {
  32.     eFirstField,
  33.     eKeyField,
  34.     ePitchField,
  35.     eVelField,
  36.     eLastField
  37.     };
  38.  
  39. typedef struct
  40.     {
  41.     long channel;
  42.     short pitch[kKeyCount];
  43.     short vel[kKeyCount];
  44.     short dur[kKeyCount];    /* in milliseconds */
  45.     Boolean zoomed;
  46.     Boolean backgroundPlay;
  47.  
  48.     short portCount;
  49.     OSType clientList[kMaxPortCount];
  50.     OSType portList[kMaxPortCount];
  51.  
  52.     } TPartialSaveRecord;
  53.  
  54.  
  55. typedef struct
  56.     {
  57.     Boolean used;
  58.  
  59.     Boolean everSaved;
  60.     Boolean changed;
  61.     Boolean littleChanged;
  62.  
  63.     FSSpec docSpec;
  64.     TPartialSaveRecord sr;
  65.  
  66.     long instrument;
  67.  
  68.     OSType outPortID;
  69.     short outPort;                        /* MIDI output port */
  70.     Boolean keyPosition[kKeyCount];        /* boolean array, compare to global one */
  71.     short selectedKey;
  72.     short tabField;                        /* which field gets entered with numbers */
  73.     Point textCursorPt;                    /* my fake inserstion point */
  74.     Boolean textCursorBlink;
  75.     short textCursorPhase;                /* 1 if visible, 0 if not */
  76.     long textCursorTicks;
  77.     WindowPtr w;
  78.     } TDoc;
  79.  
  80. typedef struct
  81.     {
  82.     long docVersion;            /* quick check that we can really open the file */
  83.     Rect windowRect;
  84.     TPartialSaveRecord sr;
  85.     } TSaveRecord;
  86.  
  87.  
  88. /*--------------------------*/
  89.  
  90. typedef struct
  91.     {
  92.     Rect keyRect[kKeyCount];
  93.     Rect controllerRect[kControllerCount];
  94.     Rect allKeyRect;
  95.     Rect keyInfoRect;
  96.     Rect pitchInfoRect;
  97.     Rect velInfoRect;
  98.  
  99.     char keyCodeToKeyPosition[256];
  100.     Rect unzoomedBounds;
  101.     Rect zoomedBounds;
  102.  
  103.     char keyMask[16];
  104.     Boolean keyPosition[kKeyCount];        /* boolean array */
  105.     short lastKeyDown;                    /* in keyposition */
  106.  
  107.     OSType midiClientID;
  108.     OSType timePortID;
  109.     short timePort;
  110.  
  111.     short portCount;                    /* count of ports we might connect to */
  112.     OSType clientList[kMaxPortCount];
  113.     OSType portList[kMaxPortCount];
  114.     Str255 portName[kMaxPortCount];
  115.  
  116.     TDoc *thisDoc;
  117.     } TGlobals;
  118.  
  119.  
  120. /*--------------------------
  121.     Variables
  122. --------------------------*/
  123.  
  124. #ifdef globals
  125.     #define VAR
  126. #else
  127.     #define VAR extern
  128. #endif
  129.  
  130. #define kFirstDocWindow 1
  131. #define kDocMax 1
  132. VAR TDoc gDoc[kDocMax];
  133. VAR short gDocCount;
  134.  
  135. VAR TGlobals *g;
  136.  
  137. #undef VAR
  138.  
  139.  
  140. /*--------------------------
  141.     Prototypes
  142. --------------------------*/
  143.  
  144. void ActivateDoc(short n);
  145. void DeactivateDoc(short n);
  146.  
  147. void NewDocFromSaveRecord(short docNumber,TSaveRecord *sr);
  148. void FixUpMenus(TDoc *d);
  149. void FixUpDocConnectionList(TDoc *d);
  150.